/*
 *接口编写处...
*如果接口需要做Action的权限验证，请在Action上使用属性
*如: [ApiActionPermission("View_船运收货",Enums.ActionPermissionOptions.Search)]
 */
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Http;
using VOL.Entity.DomainModels;
using VOL.Wms.IServices;
using VOL.Core.Utilities;
using VOL.Core.Configuration;
using Microsoft.AspNetCore.Authorization;
using VOL.Core.Filters;

namespace VOL.Wms.Controllers
{
    public partial class View_船运收货Controller
    {
        private readonly IView_船运收货Service _service;//访问业务代码
        private readonly IHttpContextAccessor _httpContextAccessor;

        [ActivatorUtilitiesConstructor]
        public View_船运收货Controller(
            IView_船运收货Service service,
            IHttpContextAccessor httpContextAccessor
        )
        : base(service)
        {
            _service = service;
            _httpContextAccessor = httpContextAccessor;
        }

        //查公司名
        [HttpGet, Route("queryWorkShopName"), FixedToken]
        public IActionResult queryWorkShopName()
        {
            WebResponseContent webResponseContent = new WebResponseContent();
            string workShopName = AppSetting.GetSection("WorkShopName").Value;
            if (string.IsNullOrEmpty(AppSetting.GetSection("WorkShopName").Value))
            {
                webResponseContent.Code = "1";
                webResponseContent.Message = "没有查询到公司名称";
            }
            else
            {
                webResponseContent.Code = "0";
                webResponseContent.Data = workShopName;
            }
            return Json(webResponseContent);
        }

        //查询船号
        [HttpGet, Route("queryBoatCode"), FixedToken]
        public IActionResult queryBoatCode(string boatCode)
        {
            WebResponseContent responseContent = new WebResponseContent();
            List<string> strings = _service.queryBoatCode(boatCode, ref responseContent);
            return Json(strings);
        }

        //查询船上有多少卷
        [HttpPost, Route("queryBoatVolumeCount"), FixedToken]
        public IActionResult queryBoatVolumeCount([FromBody] View_船运收货 view船运收货)
        {
            WebResponseContent responseContent = new WebResponseContent();
            _service.queryBoatVolumeCount(view船运收货, ref responseContent);
            return Json(responseContent);
        }
        //根据卷号查询已发送到岳阳的卷
        [HttpPost, Route("query船运已发货卷信息"), FixedToken]
        public IActionResult query船运已发货卷信息([FromBody] View_船运收货 view船运收货)
        {
            WebResponseContent responseContent = new WebResponseContent();
            _service.query船运已发货卷信息(view船运收货, ref responseContent);
            return Json(responseContent);
        }

        //岳阳收到的船运卷扫码入库
        [HttpPost, Route("submitBoatInstorage"), FixedToken]
        public IActionResult submitBoatInstorage([FromBody] View_船运收货 view船运收货)
        {
            WebResponseContent responseContent = new WebResponseContent();
            _service.submitBoatInstorage(view船运收货, responseContent);
            return Json(responseContent);
        }
    }
}
